package me.helllp.dake.generator.meta.core;

import java.util.Collections;
import java.util.Optional;
import java.util.Set;

import com.squareup.javapoet.TypeSpec;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class SmartEnum {
	private String name;
	
	private String desc;
	
	private Set<String> enumValues;
	
	public TypeSpec.Builder builder() {
		TypeSpec.Builder builder = TypeSpec.enumBuilder(name);
		Optional.ofNullable(enumValues).orElse(Collections.emptySet()).forEach(value -> builder.addEnumConstant(value));
		builder.addJavadoc(desc);
		return builder;
	}
}
